﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using YXQ.Common;
using YXQ.Service;
using YXQ.Common.Extension;
namespace YXQ.Manager.Handler
{
    /// <summary>
    /// CommonHandler 的摘要说明
    /// </summary>
    public class CommonHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {

            AJAXJson rtnMessage = new AJAXJson();
            string opType = context.Request["OpType"];
            var controler = new ControlService(context);
            if (!string.IsNullOrEmpty(opType))
            {
                switch (opType.ToLower())
                {
                    
                    case "del":
                        rtnMessage.ResultMessage = controler.DelPro();
                        break;
                    case "savepro":
                        rtnMessage.ResultMessage = controler.SavePro();
                        break;
                    case "getpro":
                        rtnMessage.ResultMessage = controler.GerProJectById();
                        break;
                    case "deluser":
                        rtnMessage.ResultMessage = controler.DelUser();
                        break;
                    case "deldep":
                        rtnMessage.ResultMessage = controler.DelDep();
                        break;
                    case "delmsg":
                        rtnMessage.ResultMessage = controler.DelMsg();
                        break;
                    default: break;
                }
            }


            context.Response.Write(rtnMessage.ToJsonItem());
            context.Response.ContentType = "text/json;charset=UTF-8;";
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}